<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;
class WagedetailsController extends Controller
{
    public function index(){
        return view("admin.wagedetails.index");
    }
    public function get_wages_all(Request $request){
        $input = $request->input();
        $start = $input['page']*$input['limit']-$input['limit'];
        $end = $input['page']*$input['limit'];
        $data = [
            'code'=>0,
            'msg'=>'',
            'count'=>DB::table("wages")->where('type',1)->count(),
            'data'=>DB::table("wages")->where('type',1)->offset($start)->limit($end)->get()
        ];
        return $data;
    }
    public function yilingqu(){
        return view("admin.wagedetails.yilingqu");
    }

    public function get_yilingqu(Request $request){
        $input = $request->input();
        $start = $input['page']*$input['limit']-$input['limit'];
        $end = $input['page']*$input['limit'];
        $data = [
            'code'=>0,
            'msg'=>'',
            'count'=>DB::table("wages")->where(['type'=>1,'starts'=>1])->count(),
            'data'=>DB::table("wages")->where(['type'=>1,'starts'=>1])->offset($start)->limit($end)->get()
        ];
        return $data;
    }

    public function weilingqu(){
        return view("admin.wagedetails.weilingqu");
    }
    public function get_weilingqu(Request $request){
        $input = $request->input();
        $start = $input['page']*$input['limit']-$input['limit'];
        $end = $input['page']*$input['limit'];
        $data = [
            'code'=>0,
            'msg'=>'',
            'count'=>DB::table("wages")->where(['type'=>1,'starts'=>0])->count(),
            'data'=>DB::table("wages")->where(['type'=>1,'starts'=>0])->offset($start)->limit($end)->get()
        ];
        return $data;
    }
}
